public class isIsomorphic {
    public boolean isIsomorphic(String s, String t) {
        //判断是不是同构的字符串
        int[] s_hash = new int[26];
        int[] t_hash = new int[26];
        for (int i = 0; i < s.length(); i++) {
            if (s_hash[s.charAt(i) - 'a'] != t_hash[t.charAt(i) - 'a']) {
                return false;
            }
            s_hash[s.charAt(i) - 'a'] = i + 1;
            t_hash[t.charAt(i) - 'a'] = i + 1;
        }
        return true;
    }
}
